import axios from 'poros/http';

// const BASE_API = 'http://10.110.96.192:8030';
const BASE_API = '';

export const getLocalUserInfo = () =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/planProcess/getJwt`,
    method: 'get',
  });

// 根据 code 获取字典数据
export const getDicList = code =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/dictData/query/${code}`,
    method: 'get',
  });

// 获取所以字典数据
export const getAllDicList = code =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/dictData/query`,
    method: 'get',
  });

//   获取组织信息列表
export const postOrganizationInfo = params =>
  axios({
    url: `${BASE_API}/api/poros-permission/secOrg/getChildren`,
    // url: `${BASE_API}/api/poros-permission/secOrg/findAllBuildTree`,
    method: 'get',
    params,
  });

//   获取组织信息列表
export const postOrganizationTree = params =>
  axios({
    // url: `${BASE_API}/api/poros-permission/secOrg/getChildren`,
    url: `${BASE_API}/api/poros-permission/secOrg/findAllBuildTree`,
    method: 'get',
    params,
  });

// 根据组织ID获取员工列表
export const getEmployerById = id =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/employeeRelations/queryByOrganization/${id}`,
    method: 'get',
  });

//根据当前用户的uid获取所处的当前组
export const getUserOrganization = id =>
  axios({
    url: `${BASE_API}/api/poros-permission/secStaff/getByUid/${id}`,
    method: 'get',
  });

//根据当前用户的uid获取用户信息
export const getUserInfo = id =>
  axios({
    url: `${BASE_API} /api/poros-permission/secStaff/getList?uids=${id}`,
    method: 'get',
  });

// 获取用户信息
export const getCurrentUser = () =>
  axios({
    url: `${BASE_API}/api/poros-permission/secStaff/getCurUser`,
    method: 'get',
  });

//发起预测接口
export const postForecast = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/process/saveOrUpdate`,
    method: 'post',
    data,
  });
// 获取部门主管
export const postDepcMgrInfo = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/common/getDepcMgrInfo`,
    method: 'post',
    data,
  });
// 获取用户销售组织
export const getUserGroup = uid =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/common/getUser/${uid}`,
    method: 'get',
  });
